import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_getx_shop/page/obs/test/TestObsController.dart';
import 'package:get/get.dart';

/// 创建人： Created by zhaolong
/// 创建时间：Created by  on 4/10/21.
///
/// 可关注公众号：我的大前端生涯   获取最新技术分享
/// 可关注网易云课堂：https://study.163.com/instructor/1021406098.htm
/// 可关注博客：https://blog.csdn.net/zl18603543572
///
///代码清单7-17
/// Gex 响应编程
class TestObsPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //注入控制器
    TestObsController _controllr = Get.put(TestObsController());
    return Scaffold(
      body: Center(
        child: Obx(() {
          return Text("Obx 当前 count 的值为 ${_controllr.getCount}");
        }),
      ),
      //点击按钮修改值
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          //修改值
          _controllr.addCount();
        },
      ),
    );
  }
}
